#define _CRT_SECURE_NO_WARNINGS

#include<iostream>

using namespace std;

int minimumPartition(string s, int k)
{
    int n = s.size();
    int count = 0;
    long long tmp = 0;

    if (n == 1)
    {
        if ((s[0] - '0') > k) return -1;
        else return s[0] - '0';
    }

    int flag = 1;
    for (int i = 0; i < n; i++)
    {
        if ((s[i] - '0') > k)
        {
            flag = 0;
            break;
        }
        tmp = 10 * tmp + (s[i] - '0');
        if (tmp > k)
        {
            tmp = 0;
            if (i == n - 1)
            {
                count++;
            }
            i--;
            count++;
        }
    }

    return flag == 1 ? count : -1;
}

int main()
{
    minimumPartition("1829727651", 10);

	return 0;
}